home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / GRAHAM / XA_6S.ZIP / SOURCE / FRM_UTIL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-31  |  848 b   |  45 lines

  1. /*
  2.  * XaAES - XaAES Ain't the AES
  3.  *
  4.  * A multitasking AES replacement for MiNT
  5.  *
  6.  */
  7.  
  8. #include <VDI.H>
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include "XA_TYPES.H"
  12. #include "XA_DEFS.H"
  13. #include "K_DEFS.H"
  14.  
  15. /*
  16.     Create a copy of an object tree
  17.     - intended for using the form templates in SYSTEM.RSC (we cann't use them
  18.     directly as this would cause problems when (for example) two apps do a form_alert()
  19.     at the same time.
  20. */
  21. OBJECT *CloneForm(OBJECT *form)
  22. {
  23.     short num_objs,o;
  24.     OBJECT *new_form;
  25.     
  26.     for(num_objs=0; !(form[num_objs].ob_flags&LASTOB); num_objs++);
  27.     
  28.     num_objs++;
  29.  
  30.     new_form=(OBJECT*)malloc(sizeof(OBJECT)*num_objs);
  31.     
  32.     for(o=0; o<num_objs; o++)
  33.         new_form[o]=form[o];
  34.     
  35.     return new_form;
  36. }
  37.  
  38. /*
  39.     Free up a copy of a form template
  40. */
  41. void DeleteClone(OBJECT *form)
  42. {
  43.     free((void*)form);
  44. }
  45.